<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 16-3-18
 * Time: 下午4:33
 */

namespace front\controllers;
use common\RestController;
use Yii;


/**
 * BannerController implements the CRUD actions for BannerModel model.
 */
class RestBaseController extends RestController{

    public $enableCsrfValidation = false;
    public $shop_id=1001;
    //格式化产品图片
    static function getImgPath($data){
        if(!$data){
            return false;
        }
        return  'http://static.shopbox.10000dt.com/goods/'.$data;
    }


    /**
     * 格式化商品价格
     *
     * @access  public
     * @param   float   $price  商品价格
     * @return  string
     */
    static function price_format($price) {
        if ($price === '') {
            $price = 0;
        }
        $price = 0 + $price;//添加这一行，转换成数值
        return number_format($price, 2,'.','');
    }

}

